<script>
	export default {
		onLaunch: async function() {
			let sys = uni.getSystemInfoSync()
			this.globalData.statusBarHeight = sys.statusBarHeight
			this.globalData.windowHeight = sys.windowHeight
			this.globalData.windowWidth = sys.windowWidth
			this.globalData.version = sys.appVersion;
			// #ifdef MP-WEIXIN
			if (wx.canIUse('getUpdateManager')) {
				const updateManager = wx.getUpdateManager();
				// 监听检查更新结果
				updateManager.onCheckForUpdate(res => {
					if (res.hasUpdate) {
						updateManager.onUpdateReady(() => {
							wx.showModal({
								title: '更新提示',
								content: '新版本已准备好，是否重启应用？',
								success: res => {
									if (res.confirm) {
										// 强制重启
										updateManager.applyUpdate();
									}
								}
							});
						});
						// 新版本下载失败
						updateManager.onUpdateFailed(() => {
							wx.showToast({
								title: '更新失败',
								icon: 'none',
								duration: 3000
							});
						});
					}
				});
			}
			// #endif
		},
		onShow: function() {},
		onHide: function() {},
		globalData: {
			sliderValue: 0,
			nowTime: '0:00'
		}
	}
</script>
<style lang="scss">
	@import "@/uni_modules/uview-ui/index.scss";
	@import "@/style/index.scss";
</style>